home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cato / Xm / XmResolveAllPartOffsets.z / XmResolveAllPartOffsets
Encoding:
Text File  |  2002-10-03  |  11.8 KB  |  265 lines

  1.  
  2.  
  3.  
  4.      XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss - A function that allows writing of
  10.           upward-compatible applications and widgets
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.           ####iiiinnnncccclllluuuuddddeeee <<<<XXXXmmmm////XXXXmmmmPPPP....hhhh>>>>
  14.  
  15.           vvvvooooiiiidddd XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss ((((_w_i_d_g_e_t__c_l_a_s_s, _o_f_f_s_e_t, _c_o_n_s_t_r_a_i_n_t__o_f_f_s_e_t))))
  16.                WWWWiiiiddddggggeeeettttCCCCllllaaaassssssss_w_i_d_g_e_t__c_l_a_s_s;;;;
  17.                XXXXmmmmOOOOffffffffsssseeeettttPPPPttttrrrr* _o_f_f_s_e_t;;;;
  18.                XXXXmmmmOOOOffffffffsssseeeettttPPPPttttrrrr* _c_o_n_s_t_r_a_i_n_t__o_f_f_s_e_t;;;;
  19.  
  20.  
  21.      VVVVEEEERRRRSSSSIIIIOOOONNNN
  22.           This page documents version 1.2 of the Motif library.
  23.  
  24.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  25.           The use of offset records requires two extra global
  26.           variables per widget class.  The variables consist of
  27.           pointers to arrays of offsets into the widget record and
  28.           constraint record for each part of the widget structure.
  29.           The XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss function allocates the offset
  30.           records needed by an application to guarantee upward-
  31.           compatible access to widget instance and constraint records
  32.           by applications and widgets.  These offset records are used
  33.           by the widget to access all of the widget's variables.  A
  34.           widget needs to take the following steps:
  35.  
  36.  
  37.             +o  Instead of creating a resource list, the widget creates
  38.                an offset resource list.  To help you accomplish this,
  39.                use the XXXXmmmmPPPPaaaarrrrttttRRRReeeessssoooouuuurrrrcccceeee structure and the XXXXmmmmPPPPaaaarrrrttttOOOOffffffffsssseeeetttt
  40.                macro.  The XXXXmmmmPPPPaaaarrrrttttRRRReeeessssoooouuuurrrrcccceeee data structure looks just
  41.                like a resource list, but instead of having one integer
  42.                for its offset, it has two shorts.  This is put into
  43.                the class record as if it were a normal resource list.
  44.                Instead of using XXXXttttOOOOffffffffsssseeeetttt for the offset, the widget
  45.                uses XXXXmmmmPPPPaaaarrrrttttOOOOffffffffsssseeeetttt.
  46.  
  47.                If the widget is a subclass of the Constraint class and
  48.                it defines additional constraint resources, create an
  49.                offset resource list for the constraint part as well.
  50.                Instead of using XXXXttttOOOOffffffffsssseeeetttt for the offset, the widget
  51.                uses XXXXmmmmCCCCoooonnnnssssttttrrrraaaaiiiinnnnttttPPPPaaaarrrrttttOOOOffffffffsssseeeetttt in the constraint resource
  52.                list.
  53.  
  54.                XmPartResource resources[] = {
  55.                  {  BarNxyz, BarCXyz, XmRBoolean, sizeof(Boolean),
  56.                     XmPartOffset(Bar,xyz), XmRImmediate, (XtPointer)False } };
  57.  
  58.                XmPartResource constraints[] = {
  59.                  {  BarNmaxWidth, BarNMaxWidth,
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 4/30/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))
  71.  
  72.  
  73.  
  74.                          XmRDimension, sizeof(Dimension),
  75.                          XmConstraintPartOffset(Bar,max_width),
  76.                          XmRImmediate, (XtPointer)100 } };
  77.  
  78.  
  79.             +o  Instead of putting the widget size in the class record,
  80.                the widget puts the widget part size in the same field.
  81.                If the widget is a subclass of the Constraint class,
  82.                instead of putting the widget constraint record size in
  83.                the class record, the widget puts the widget constraint
  84.                part size in the same field.
  85.  
  86.             +o  Instead of putting XXXXttttVVVVeeeerrrrssssiiiioooonnnn in the class record, the
  87.                widget puts XXXXttttVVVVeeeerrrrssssiiiioooonnnnDDDDoooonnnnttttCCCChhhheeeecccckkkk in the class record.
  88.  
  89.             +o  Define a variable, of type XXXXmmmmOOOOffffffffsssseeeettttPPPPttttrrrr, to point to the
  90.                offset record.  If the widget is a subclass of the
  91.                Constraint class, define a variable of type XmOffsetPtr
  92.                to point to the constraint offset record.  These can be
  93.                part of the widget's class record or separate global
  94.                variables.
  95.  
  96.             +o  In class initialization, the widget calls
  97.                XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss, passing it pointers to the
  98.                class record, the address of the offset record, and the
  99.                address of the constraint offset record.  If the widget
  100.                not is a subclass of the Constraint class, it should
  101.                pass NULL as the address of the constraint offset
  102.                record.  This does several things:
  103.  
  104.                Adds the superclass (which, by definition, has already
  105.                been initialized) size field to the part size field
  106.  
  107.                If the widget is a subclass of the Constraint class,
  108.                adds the superclass constraint size field to the
  109.                constraint size field
  110.  
  111.                Allocates an array based upon the number of
  112.                superclasses
  113.  
  114.                If the widget is a subclass of the constraint class,
  115.                allocates an array for the constraint offset record
  116.  
  117.                Fills in the offsets of all the widget parts and
  118.                constraint parts with the appropriate values,
  119.                determined by examining the size fields of all
  120.                superclass records
  121.  
  122.                Uses the part offset array to modify the offset entries
  123.                in the resource list to be real offsets, in place
  124.  
  125.             +o  The widget defines a constant which will be the index
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 4/30/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))
  137.  
  138.  
  139.  
  140.                to its part structure in the offsets array.  The value
  141.                should be 1 greater than the index of the widget's
  142.                superclass.  Constants defined for all Xm widgets can
  143.                be found in XXXXmmmmPPPP....hhhh.
  144.  
  145.                #define BarIndex (XmBulletinBIndex + 1)
  146.  
  147.  
  148.             +o  Instead of accessing fields directly, the widget must
  149.                always go through the offset table.  The XXXXmmmmFFFFiiiieeeelllldddd and
  150.                XXXXmmmmCCCCoooonnnnssssttttrrrraaaaiiiinnnnttttFFFFiiiieeeelllldddd macros help you access these fields.
  151.                Because the XXXXmmmmPPPPaaaarrrrttttOOOOffffffffsssseeeetttt, XXXXmmmmCCCCoooonnnnssssttttrrrraaaaiiiinnnnttttPPPPaaaarrrrttttOOOOffffffffsssseeeetttt,
  152.                XXXXmmmmFFFFiiiieeeelllldddd, and XXXXmmmmCCCCoooonnnnssssttttrrrraaaaiiiinnnnttttFFFFiiiieeeelllldddd macros concatenate
  153.                things together, you must ensure that there is no space
  154.                after the part argument.  For example, the following
  155.                macros do not work because of the space after the part
  156.                (Label) argument:
  157.  
  158.                XmField(w, offset, Label , text, char *)
  159.                XmPartOffset(Label , text).
  160.  
  161.                Therefore, you must not have any spaces after the part
  162.                (Label) argument, as illustrated here:
  163.  
  164.                XmField(w, offset, Label, text, char *)
  165.  
  166.                You can define macros for each field to make this
  167.                easier.  Assume an integer field _x_y_z:
  168.  
  169.                #define BarXyz(w) (*(int *)(((char *) w) + \
  170.                  offset[BarIndex] + XtOffset(BarPart,xyz)))
  171.  
  172.  
  173.                For constraint field _m_a_x__w_i_d_t_h:
  174.  
  175.                #define BarMaxWidth(w) \
  176.                  XmConstraintField(w,constraint_offsets,Bar,max_width,Dimension)
  177.  
  178.  
  179.           The parameters for XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss are defined
  180.           below:
  181.  
  182.  
  183.           _w_i_d_g_e_t__c_l_a_s_s
  184.                     Specifies the widget class pointer for the created
  185.                     widget
  186.  
  187.           _o_f_f_s_e_t    Returns the offset record
  188.  
  189.           _c_o_n_s_t_r_a_i_n_t__o_f_f_s_e_t
  190.                     Returns the constraint offset record
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 4/30/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      XXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmRRRReeeessssoooollllvvvveeeeAAAAllllllllPPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX))))
  203.  
  204.  
  205.  
  206.      RRRREEEELLLLAAAATTTTEEEEDDDD IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN
  207.           XXXXmmmmRRRReeeessssoooollllvvvveeeePPPPaaaarrrrttttOOOOffffffffsssseeeettttssss((((3333XXXX)))).
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.      Page 4                                          (printed 4/30/98)
  262.  
  263.  
  264.  
  265.